﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for ESanPham
/// </summary>
public class ESanPham
{
    private string maSP;
    private string tenSP;
    private int loaiSP;
    private int gia;
    private int soLuong;
    private DateTime ngayDang;
    private string hinhAnh;
    private string noiSX;
    private string chiTietSP;
    private int danhChoDoTuoi;
    private string danhChoGioiTinh;
    private string trangThai;
    private int luotXemSP;
    public ESanPham()
    { }
    public ESanPham(string maSP, string tenSP, int loaiSP, int gia, int soLuong, DateTime ngayDang, string hinhAnh, string noiSX, string chiTietSP,int danhChoDoTuoi,string danhChoGioiTinh, string trangThai, int luotXemSP)
    {
        this.maSP = maSP;
        this.tenSP = tenSP;
        this.loaiSP = loaiSP;
        this.gia = gia;
        this.soLuong = soLuong;
        this.ngayDang = ngayDang;
        this.hinhAnh = hinhAnh;
        this.noiSX = noiSX;
        this.chiTietSP = chiTietSP;
        this.danhChoDoTuoi = danhChoDoTuoi;
        this.danhChoGioiTinh = danhChoGioiTinh;
        this.trangThai = trangThai;
        this.luotXemSP = luotXemSP;
    }
    public string MaSP
    {
        get { return this.maSP; }
        set
        {
            if (value == null)
                throw new Exception("maSP not allow nullvalue.");
            this.maSP = value;
        }
    }
    public string TenSP
    {
        get { return this.tenSP; }
        set
        {
            if (value == null)
                throw new Exception("tenSP not allow nullvalue.");
            this.tenSP = value;
        }
    }
    public int LoaiSP
    {
        get { return this.loaiSP; }
        set
        {
            if (value == null)
                throw new Exception("loaiSP not allow nullvalue.");
            this.loaiSP = value;
        }
    }
    public int DanhChoDoTuoi
    {
        get { return this.danhChoDoTuoi; }
        set
        {
            if (value == null)
                throw new Exception("loaiSP not allow nullvalue.");
            this.danhChoDoTuoi = value;
        }
    }
    public int Gia
    {
        get { return this.gia; }
        set { this.gia = value; }
    }
    public int SoLuong
    {
        get { return this.soLuong; }
        set { this.soLuong = value; }
    }
    public DateTime NgayDang
    {
        get { return this.ngayDang; }
        set { this.ngayDang = value; }
    }
    public string HinhAnh
    {
        get { return this.hinhAnh; }
        set { this.hinhAnh = value; }
    }
    public string DanhChoGioiTinh
    {
        get { return this.danhChoGioiTinh; }
        set { this.danhChoGioiTinh = value; }
    }
    public string NoiSX
    {
        get { return this.noiSX; }
        set { this.noiSX = value; }
    }
    public int LuotXemSP
    {
        get { return this.luotXemSP; }
        set { this.luotXemSP = value; }
    }
    public string ChiTietSP
    {
        get { return this.chiTietSP; }
        set { this.chiTietSP = value; }
    }
    public string TrangThai
    {
        get { return this.trangThai; }
        set { this.trangThai = value; }
    }
    public override string ToString()
    {
        return this.maSP + "; " + this.tenSP + "; " + this.loaiSP + "; " + this.gia + "; " + this.soLuong + "; " + this.ngayDang + "; " + this.hinhAnh + "; " + this.noiSX + "; " + this.chiTietSP + "; "+ this.danhChoDoTuoi + "; "+this.danhChoGioiTinh +";"+ this.trangThai + "; "+this.luotXemSP+";";
    }
    public override bool Equals(Object obj)
    {
        ESanPham me = (ESanPham)obj;
        bool ret = this.MaSP.Equals(me.MaSP);
        return ret;
    }
    public override int GetHashCode()
    {
        return this.MaSP.GetHashCode();
    }

}